<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:include href='../xsl.include.main.xsl'/>

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&#32;</xsl:text>
</xsl:template>
<xsl:template match='quote' name='quote'>
<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>
</xsl:template>
<xsl:template match='crlf' name='crlf'>
<xsl:text disable-output-escaping='yes'>&#10;</xsl:text>
</xsl:template>

<xsl:template match="messageWrite">

<FORM style="margin: 0px; display:inline;" name="sendmail" METHOD="POST" ENCTYPE="multipart/form-data" ACTION="/mailbox/IM.mailbox.aspx">
<INPUT TYPE="hidden" NAME="DraftMsgId" value="{@DraftMsgId}"></INPUT>
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-tl.gif" width="8" border="0"/></TD>
			<TD width="60px" colspan="1" background="/imgs/pvts/box-t-back.gif"  bgcolor="white"><IMG height="8" src="/imgs/pvts/box-t.gif" width="10" border="0"/></TD>
			<TD  colspan="1" background="/imgs/pvts/box-t-back.gif"  bgcolor="white"><IMG height="8" src="/imgs/pvts/box-t.gif" width="10" border="0"/></TD>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-tr.gif" width="8" border="0"/></TD>
		</TR>
<!-- DA -->
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" align="left" style="padding:5px; height:20px; width:60px; border-bottom: 1px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				Da:
			</TD>
			<TD align="left" style="padding:5px; border-bottom: 1px solid #EBE9E4;" bgcolor="white">
				<INPUT TYPE="hidden" NAME="senderName" value="{@senderName}"></INPUT>
				<INPUT TYPE="hidden" NAME="senderEmail" value="{@senderEmail}"></INPUT>
				<xsl:value-of select="@senderName"/>&#160;&lt;<xsl:value-of select="@senderEmail"/>&gt;<br/><span style="font-size:0.9em; color:grey;">(ip address: <xsl:value-of select="/messageWrite/@senderIP"/>)</span>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
<!-- A -->
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" align="left" style="padding:5px; height:20px; border-bottom: 0px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				A:
			</TD>
			<TD  align="left" style="padding:5px; border-bottom: 0px solid #EBE9E4;" bgcolor="white">
				<TEXTAREA id="TA.TO" name="TA.TO" rows="2" cols="55" WRAP="SOFT" style="height:3em;">
					<xsl:for-each select='to'><xsl:value-of select="@mailto"/></xsl:for-each>
				</TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
<!-- CC -->
<xsl:choose>
<xsl:when test="not(count(cc) &gt; 0)">
<div id="CC" style="visibility:hidden; position:absolute; width:1%;">
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" align="left" style="padding:5px; height:20px; border-top: 1px solid #EBE9E4; text-align:right; padding-right:10px; width:60px;" bgcolor="white">
				Cc:
			</TD>
			<TD  align="left" style="padding:5px; border-top: 1px solid #EBE9E4;" bgcolor="white">
				<TEXTAREA id="TA.CC" name="TA.CC" rows="2" cols="55" WRAP="SOFT" style="height:3em;"><xsl:for-each select='cc'><xsl:value-of select="@mailto"/></xsl:for-each></TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</div>
</xsl:when>
<xsl:when test='count(cc) &gt; 0'>
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" align="left" style="padding:5px; height:20px; border-top: 1px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				Cc:
			</TD>
			<TD  align="left" style="padding:5px; border-top: 1px solid #EBE9E4;" bgcolor="white">
				<TEXTAREA id="TA.CC" name="TA.CC" rows="2" cols="55" WRAP="SOFT" style="height:3em;"><xsl:for-each select='cc'><xsl:value-of select="@mailto"/></xsl:for-each></TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</xsl:when>
</xsl:choose>
<!-- CCN -->
<xsl:choose>
<xsl:when test="not(string-length(@TA.CCN) &gt; 0)">
<div name="CCN" id="CCN" style="position:absolute; visibility:hidden; width:1%;" >
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white" ></TD>
			<TD width="60px" align="left" style="padding:5px; height:20px; border-top: 1px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				Ccn:
			</TD>
			<TD  align="left" style="padding:5px; border-top: 1px solid #EBE9E4;" bgcolor="white">
				<TEXTAREA id="TA.CCN" name="TA.CCN" rows="2" cols="55" WRAP="SOFT" style="height:3em;"><xsl:value-of select="@TA.CCN"/></TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</div>
</xsl:when>
<xsl:when test='string-length(@TA.CCN) &gt; 0'>
<div name="CCN" id="CCN" style="position:relative; visibility:visible; width:100%;" >
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white" ></TD>
			<TD width="60px" align="left" style="padding:5px; height:20px; border-top: 1px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				Ccn:
			</TD>
			<TD  align="left" style="padding:5px; border-top: 1px solid #EBE9E4;" bgcolor="white">
				<TEXTAREA id="TA.CCN" name="TA.CCN" rows="2" cols="55" WRAP="SOFT" style="height:3em;"><xsl:value-of select="@TA.CCN"/></TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</div>
</xsl:when>
</xsl:choose>
<!-- ADD CC | ADD CCN -->
<xsl:if test="@itype &gt; 2">
<xsl:if test="not(count(cc) &gt; 0) or not(count(@TA.CCN) &gt; 0)">
<div name="ADDCCC" id="ADDCCC" style="position:relative; visibility:visible; width:100%;" >
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" style="padding-left:5px; padding-bottom:5px; text-align:right; padding-right:10px;" bgcolor="white">&#160;</TD>
			<TD  align="left" style="padding-left:10px; padding-bottom:5px; " bgcolor="white">
				<xsl:choose>
				<xsl:when test="not(count(cc) &gt; 0) and count(@TA.CCN) &gt; 0">
					<span id="ADDCC"><a href="javascript:showCC('0');" style="padding-right:5px; text-decoration:underline; color:#666666;">Add Cc:</a></span>
				</xsl:when>
				<xsl:when test="not(count(cc) &gt; 0)">
					<span id="ADDCC"><a href="javascript:showCC('0');" style="padding-right:5px; text-decoration:underline; color:#666666;">Add Cc:</a></span><span id="ADDCCN">|<a style="padding-left:5px; text-decoration:underline; color:#666666;" href="javascript:showCCN('0');">Add Ccn:</a></span>
				</xsl:when>
				<xsl:when test='count(cc) &gt; 0'>
					<span id="ADDCCN"><a style="padding-left:0px; text-decoration:underline; color:#666666;" href="javascript:showCCN('1');">Add Ccn:</a></span>
				</xsl:when>
				</xsl:choose>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</div>
</xsl:if>
<div name="ADDCCN2" id="ADDCCN2" style="position:absolute; visibility:hidden; width:1%;" >
<TABLE width="100%" class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" style="padding-left:5px; padding-bottom:5px; text-align:right; padding-right:10px;" bgcolor="white">&#160;</TD>
			<TD  align="left" style="padding-left:10px; padding-bottom:5px; " bgcolor="white">
				<span id="ADDCCN"><a style="padding-left:0px; text-decoration:underline; color:#666666;" href="javascript:showCCN('1');">Add Ccn:</a></span>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</div>
</xsl:if>
<!-- OGGETTO -->
<TABLE class="body" cellSpacing="0" cellPadding="0"  border="0" width="100%">
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" style="padding:5px; height:20px; border-bottom: 1px solid #EBE9E4; border-top: 1px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				Oggetto:
			</TD>
			<TD  align="left" style="padding:5px; border-bottom: 1px solid #EBE9E4; border-top: 1px solid #EBE9E4; " bgcolor="white">
				<TEXTAREA id="TA.SUBJECT" name="TA.SUBJECT" rows="1" cols="55" WRAP="SOFT" style="height:3em;"><xsl:value-of select="/messageWrite/@TA.SUBJECT"/>
				</TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
<!-- ATTACH -->
<xsl:if test="@itype &gt; 2">
<TABLE class="body" cellSpacing="0" cellPadding="0"  border="0" width="100%">
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="60px" style="padding:5px; height:20px; border-bottom: 1px solid #EBE9E4; text-align:right; padding-right:10px;" bgcolor="white">
				<img src="/imgs/paperclip.gif"/>Allega:
			</TD>
			<TD  align="left" style="padding:5px; border-bottom: 1px solid #EBE9E4;" bgcolor="white">
					<INPUT TYPE="hidden" NAME="verytmpfolder" value="{@verytmpfolder}"></INPUT>
					<INPUT TYPE="FILE" SIZE="45" NAME="filename"></INPUT>
					<xsl:for-each select='attachme'>
						<INPUT TYPE="hidden" NAME="attachedFilename" value="{@filename}"></INPUT>
						<INPUT TYPE="hidden" NAME="attachedContentType" value="{@content-type}"></INPUT>
					</xsl:for-each>
					<INPUT style="margin-left:10px;" TYPE="SUBMIT" NAME="attachme" VALUE="Allega!"></INPUT>
				<br/>
					<input type="hidden" name="detachme" value="{/messageWrite/message/@folder}"></input>
					<INPUT TYPE="hidden" NAME="detachThisOne"></INPUT>
					<xsl:for-each select='attachme'>
						<span style="border:none; margin-top:2px; color:black; font-size:8pt;"><xsl:value-of select="@filename"/></span>
						<a style="margin-top:2px; margin-left:2px; font-size:8pt; text-decoration:underline;" onclick="javascript:document.sendmail.detachThisOne.value='{@filename}';" href="javascript:document.sendmail.submit();">rimuovi</a>
						<br/>
					</xsl:for-each>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
</xsl:if>
<!-- BODY -->
<TABLE class="body" cellSpacing="0" cellPadding="0"  border="0" >
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="100%" colspan="2" style="padding:2px; border-bottom: 1px solid #EBE9E4; text-align:left; padding:10px;" bgcolor="white">
				<TEXTAREA id="TA.BODY" name="TA.BODY" rows="15" cols="65" WRAP="SOFT"><xsl:value-of select="body/@TA.BODY"/></TEXTAREA>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
<!-- SEND MESSAGE -->
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif" bgcolor="white"></TD>
			<TD width="100%" colspan="2" style="padding:2px; border-bottom: 1px solid #EBE9E4; text-align:left; padding:10px;" bgcolor="white">
			<input type="SUBMIT" style="width:8em; font-weight:bold;" name="ACTUALLYSEND" value="Invia"/><input type="SUBMIT" style="width:8em; margin-left:10px;" name="SAVEASDRAFT" value="Salva bozza"/>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif" bgcolor="white"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>

		<TR>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-bl.gif" width="8" border="0"/></TD>
			<TD width="100%" colspan="2" background="/imgs/pvts/box-b.gif" bgcolor="white"><IMG height="8" src="/imgs/pvts/box-b.gif" width="10" border="0"/></TD>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-br.gif" width="8" border="0"/></TD>
		</TR>
</TABLE>
				</FORM>

</xsl:template>

</xsl:stylesheet>